package com.syni.mdd.sjb.common.datatreaure.mybatis;

import com.baomidou.mybatisplus.core.metadata.IPage;

import java.util.HashMap;
import java.util.Map;

/**
 * @className MybatisUtils
 * @description TOO
 * @Author cfx
 * @DATE 2020/3/19 20:48
 * @VERSION 1.0
 **/
public class MybatisUtils {
    public static Map<String,Object> UserData(IPage iPage){
        Map<String,Object> userData = new HashMap<>();
        userData.put("count",iPage.getTotal());
        userData.put("pageNum",iPage.getCurrent());
        userData.put("pageSize",iPage.getSize());
        return userData;
    }

    public static Map<String,Object> UserData(Map<String,Object> userData,IPage iPage){
        userData.put("count",iPage.getTotal());
        userData.put("pageNum",iPage.getCurrent());
        userData.put("pageSize",iPage.getSize());
        return userData;
    }
    public static Map<String,Object> UserData(Integer pageNum,Integer pageSize,Integer count){
        Map<String,Object> userData = new HashMap<>();
        userData.put("count",count);
        userData.put("pageNum",pageNum);
        userData.put("pageSize",pageSize);
        return userData;
    }

    public static Map<String,Object> defaultUserData(Integer pageNum,Integer pageSize,Integer count){
        Map<String,Object> userData = new HashMap<>();
        userData.put("count",0);
        userData.put("pageNum",0);
        userData.put("pageSize",0);
        return userData;
    }
}
